package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/12/18.
 */

public class ResClassify {
    private String resname;
    private int restype;
    private String resurl;
    private String resicon;
    private String resid;

    public static List<ResClassify> parseFromJson(JSONArray jsonArray) {
        List<ResClassify> list = new ArrayList<>();
        for (int a = 0; a < jsonArray.length(); a++) {
            ResClassify bean = new ResClassify();
            JSONObject jsonObj = null;
            try {
                jsonObj = jsonArray.getJSONObject(a);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            bean.setResname(jsonObj.optString("resname"));
            bean.setRestype(jsonObj.optInt("restype"));
            bean.setResurl(jsonObj.optString("resurl"));
            bean.setResicon(jsonObj.optString("resicon"));
            bean.setResid(jsonObj.optString("resid"));
            list.add(bean);
        }
        return list;
    }

    public String getResname() {
        return resname;
    }

    public void setResname(String resname) {
        this.resname = resname;
    }

    public int getRestype() {
        return restype;
    }

    public void setRestype(int restype) {
        this.restype = restype;
    }

    public String getResurl() {
        return resurl;
    }

    public void setResurl(String resurl) {
        this.resurl = resurl;
    }

    public String getResicon() {
        return resicon;
    }

    public void setResicon(String resicon) {
        this.resicon = resicon;
    }

    public String getResid() {
        return resid;
    }

    public void setResid(String resid) {
        this.resid = resid;
    }
}
